#ifndef ANIMATEDSPLASHSCREEN_H
#define ANIMATEDSPLASHSCREEN_H

#include <QWidget>
#include <QPropertyAnimation>
#include <QLabel>

class AnimatedSplashScreen : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(float opacity READ opacity WRITE setOpacity)

public:
    explicit AnimatedSplashScreen(const QString &userName = "", QWidget *parent = nullptr);

    float opacity() const { return m_opacity; }
    void setOpacity(float opacity);

    void startAnimation();
    void setUserName(const QString &userName); // 设置用户名

signals:
    void finished();

protected:
    void paintEvent(QPaintEvent *event) override; // 添加paintEvent声明

private:
    void setupUI();

    float m_opacity;
    QPropertyAnimation *m_fadeAnimation;
    QLabel *m_welcomeLabel;
    QLabel *m_userLabel;
    QString m_userName;
};

#endif // ANIMATEDSPLASHSCREEN_H
